home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH2 / SRC / RECT.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-12-20  |  1.5 KB  |  60 lines

  1. VERSION 4.00
  2. Begin VB.Form RectForm 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Rectangle and RoundRect"
  5.    ClientHeight    =   4140
  6.    ClientLeft      =   1350
  7.    ClientTop       =   1770
  8.    ClientWidth     =   6690
  9.    Height          =   4830
  10.    Left            =   1290
  11.    LinkTopic       =   "RectForm"
  12.    ScaleHeight     =   276
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   446
  15.    Top             =   1140
  16.    Width           =   6810
  17.    Begin VB.Menu mnuFile 
  18.       Caption         =   "&File"
  19.       Begin VB.Menu mnuFileExit 
  20.          Caption         =   "E&xit"
  21.       End
  22.    End
  23. Attribute VB_Name = "RectForm"
  24. Attribute VB_Creatable = False
  25. Attribute VB_Exposed = False
  26. Option Explicit
  27. Private Sub Form_Resize()
  28. Dim hgt As Integer
  29. Dim dh As Integer
  30. Dim wid As Integer
  31. Dim dw As Integer
  32. Dim ymid As Integer
  33. Dim xmid As Integer
  34. Dim i As Integer
  35. Dim s As Integer
  36. Dim round As Boolean
  37.     Cls
  38.     hgt = ScaleHeight * 0.1
  39.     dh = ScaleHeight * 0.4 / 5
  40.     wid = ScaleWidth * 0.5
  41.     dw = -ScaleWidth * 0.4 / 5
  42.     ymid = ScaleHeight / 2
  43.     xmid = ScaleWidth / 2
  44.     For i = 1 To 5
  45.         If round Then
  46.             s = RoundRect(hDC, xmid - wid, ymid - hgt, xmid + wid, ymid + hgt, 50, 30)
  47.         Else
  48.             s = Rectangle(hDC, xmid - wid, ymid - hgt, xmid + wid, ymid + hgt)
  49.         End If
  50.         round = Not round
  51.         
  52.         wid = wid + dw
  53.         hgt = hgt + dh
  54.     Next i
  55.     Refresh
  56. End Sub
  57. Private Sub mnuFileExit_Click()
  58.     Unload Me
  59. End Sub
  60.